home *** CD-ROM | disk | FTP | other *** search
/ MacFormat 1995 June / MacFormat 25.iso / Shareware City / Developers / OutOfPhase1.1 Source / OutOfPhase Folder / Level 1 Extensions 04Jan95 / Scroll.h < prev    next >
Encoding:
C/C++ Source or Header  |  1994-05-26  |  2.8 KB  |  86 lines  |  [TEXT/KAHL]

  1. /* Scroll.h */
  2.  
  3. #ifndef Included_Scroll_h
  4. #define Included_Scroll_h
  5.  
  6. /* Scroll module depends on: */
  7. /* MiscInfo.h */
  8. /* Audit */
  9. /* Debug */
  10. /* Definitions */
  11. /* Memory */
  12. /* Screen */
  13. /* EventLoop */
  14.  
  15. #include "Screen.h"
  16. #include "EventLoop.h"
  17.  
  18. struct ScrollRec;
  19. typedef struct ScrollRec ScrollRec;
  20.  
  21. /* what direction does the scrollbar go */
  22. typedef enum {eVScrollBar EXECUTE(= -7669), eHScrollBar} ScrollBarType;
  23.  
  24. /* these opcodes are passed to the scroll hook procedure */
  25. typedef enum
  26.     {
  27.         eScrollToPosition EXECUTE(= -3687),
  28.         eScrollPageMinus,
  29.         eScrollPagePlus,
  30.         eScrollLineMinus,
  31.         eScrollLinePlus
  32.     } ScrollType;
  33.  
  34. /* create a new scroll bar, returning a Ptr to the private data structure. */
  35. /* Length is the total number of pixels long the scroll bar is */
  36. /* The scrollbar is initially in a DISABLED state. */
  37. ScrollRec*            NewScrollBar(WinType* TheWindow, ScrollBarType Kind,
  38.                                     OrdType X, OrdType Y, OrdType Length);
  39.  
  40. /* dispose the scroll bar record allocated by NewScrollBar */
  41. void                        DisposeScrollBar(ScrollRec* TheBar);
  42.  
  43. /* get the position on the screen of the scroll bar */
  44. OrdType                    GetScrollXPosition(ScrollRec* TheBar);
  45. OrdType                    GetScrollYPosition(ScrollRec* TheBar);
  46. OrdType                    GetScrollLength(ScrollRec* TheBar);
  47.  
  48. /* set the position of the scroll bar on the screen */
  49. void                        SetScrollLocation(ScrollRec* TheBar, OrdType NewX, OrdType NewY,
  50.                                     OrdType NewLength);
  51.  
  52. /* get the maximum number of indices the scroll bar can have */
  53. long                        GetMaxScrollIndex(ScrollRec* TheBar);
  54.  
  55. /* get the current index for the scroll bar's position */
  56. long                        GetCurrentScrollIndex(ScrollRec* TheBar);
  57.  
  58. /* set the maximum number of indices the scroll bar can have */
  59. void                        SetMaxScrollIndex(ScrollRec* TheBar, long NewMaxScrollIndex);
  60.  
  61. /* set the current index; NewIndex may be out of range */
  62. void                        SetScrollIndex(ScrollRec* TheBar, long NewIndex);
  63.  
  64. /* enable or disable the scroll bars (for inactive windows) */
  65. void                        EnableScrollBar(ScrollRec* TheBar);
  66. void                        DisableScrollBar(ScrollRec* TheBar);
  67.  
  68. /* redraw the scroll bar normally */
  69. void                        RedrawScrollBar(ScrollRec* TheBar);
  70.  
  71. /* call this when the mouse goes down in the scroll bar, providing the */
  72. /* information which came with the mouse down event.  ScrollHook is a routine */
  73. /* which actually performs the scrolling: */
  74. /* If How == eScrollToPosition, then scroll and redraw the image at the index */
  75. /* represented by Parameter */
  76. /* If How == eScrollPageMinus or eScrollPagePlus, then scroll as much of the */
  77. /* image is necessary to scroll a page worth */
  78. void                        ScrollHitProc(ScrollRec* TheBar, ModifierFlags Modifiers,
  79.                                     OrdType X, OrdType Y, void* Refcon,
  80.                                     void (*ScrollHook)(long Parameter, ScrollType How, void* Refcon));
  81.  
  82. /* see if the position is in the scrollbar box */
  83. MyBoolean                ScrollHitTest(ScrollRec* TheBar, OrdType X, OrdType Y);
  84.  
  85. #endif
  86.